import 'package:firstdemo/util/Toast.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';

import 'navigatorMain.dart';

class navigatorSecond extends StatelessWidget {
  String param;

  navigatorSecond(this.param);

  @override
  Widget build(BuildContext context) {
    // TODO: implement build
    ToastUtil.toast("传入的参数:" + param);
    return new Scaffold(
        appBar: new AppBar(title: new Text("导航->第二个页面")),
        body: Padding(
          padding: EdgeInsets.all(12),
          child: Wrap(
            spacing: 10,
            runSpacing: 10,
            children: <Widget>[
              RaisedButton(
                  child: Text(
                    "popWithResult",
                    style: TextStyle(fontSize: 22),
                  ),
                  textTheme: ButtonTextTheme.accent,
                  onPressed: () {
                    print("canPop: " + Navigator.canPop(context).toString());
                    Navigator.maybePop(context)
                        .then((value) => print("maybePop " + value.toString()));
//                    Navigator.pop(
//                        context, "Like"
//                    );
                  }),
              RaisedButton(
                  child: Text(
                    "removeRoute",
                    style: TextStyle(fontSize: 22),
                  ),
                  textTheme: ButtonTextTheme.accent,
                  onPressed: () {
                    Navigator.removeRoute(
                        context,
                        new CupertinoPageRoute(
                            builder: (context) => new navigatorMain()));
//                    Navigator.pop(
//                        context, "Like"
//                    );
                  }),
            ],
          ),
        ));
  }
}
